<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <t-image-viewer v-model:visible="ImgVisible" :images="[getLinkUrl(ImgUrl)]"> </t-image-viewer>
    <div
      class="decorate"
      :style="{
        'background-image': `url(${publicUrls + 'free/style1/exhibitionStandStyle2zs.webp'})`,
      }"
    ></div>
    <div
      :style="{
        'background-image': `url(${publicUrls + 'free/style1/exhibitionStandStyle2Item.webp'})`,
      }"
      @contextmenu.stop="emit('onContextMenuChild', $event, index)"
      class="exhibits-item"
      v-for="(item, index) in props.info.showpieceList"
      :key="index"
    >
      <div class="cover-box">
        <img class="cover" v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
        <img class="flower-btn" v-lazy="publicUrls + 'free/style1/flower.png?imageView2/format/webp'" />
        <div class="mask-layer" @click="viewImg(item.moduleId, item.id)">
          <p>{{ item.name }}</p>
        </div>
        <img class="shadown" v-lazy="publicUrls + 'free/style1/shadown.png?imageView2/format/webp'" alt="" />
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'style2',
});
</script>
 
<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};
const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 10px;
}
.exhibits-content::after {
  content: '';
  position: absolute;
  bottom: -15px; /* 根据需要调整倒影与盒子的距离 */
  left: 0;
  width: 100%;
  height: 100%; /* 根据需要调整倒影的高度 */
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.exhibits-item {
  width: 286px;
  height: 753px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  padding-top: 202px;
  margin-left: -8px;
  -webkit-box-reflect: below -15% linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15));
  z-index: 1;
  &:first-child {
    margin-left: 0px;
  }
  .cover-box {
    width: 165px;
    height: 250px;
    background: #f2e9d8;
    position: relative;
    &:hover {
      .mask-layer {
        opacity: 1;
      }
      .flower-btn {
        display: none;
      }
    }
    .cover {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
    .flower-btn {
      width: 40px;
      height: 40px;
      object-fit: cover;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: flower 2s linear infinite;
      @keyframes flower {
        0% {
          opacity: 0;
        }
        40% {
          opacity: 100%;
        }
        80% {
          opacity: 100%;
        }
        100% {
          opacity: 0;
        }
      }
    }
    .mask-layer {
      width: 165px;
      height: 250px;
      position: absolute;
      top: 0;
      left: 0;
      background: rgba(85, 59, 42, 0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.5s ease;
      opacity: 0;
      ::v-deep p {
        width: 100%;
        padding: 0 10px;
        color: #fef3df;
        text-align: center;
        font-family: 'SourceHanSerifCN-Bold';
        font-size: 18px;
        line-height: 24px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }
    .shadown {
      width: 100%;
      height: 3px;
      position: absolute;
      bottom: -2px;
      left: 0;
    }
  }
}
.decorate {
  width: 137px;
  height: 476px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  margin-top: 278px;
  -webkit-box-reflect: below -5% linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15));
}
</style>
